package com.flmz.friend.controller.question;

import com.flmz.common.core.controller.BaseController;
import com.flmz.common.core.domain.R;
import com.flmz.common.core.domain.TableDataInfo;
import com.flmz.friend.domain.question.dto.QuestionQueryDTO;
import com.flmz.friend.domain.question.vo.QuestionDetailVO;
import com.flmz.friend.domain.question.vo.QuestionVO;
import com.flmz.friend.service.question.IQuestionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/question")
public class QuestionController extends BaseController {

	@Autowired
	private IQuestionService questionService;

	@GetMapping("/semiLogin/list")
	public TableDataInfo list(QuestionQueryDTO questionQueryDTO) {
		return questionService.list(questionQueryDTO);
	}

	@GetMapping("/semiLogin/hotList")
	public R<List<QuestionVO>> hotList() {
		return R.ok(questionService.hotList());
	}

	@GetMapping("/detail")
	public R<QuestionDetailVO> detail(Long questionId) {
		return R.ok(questionService.detail(questionId));
	}

	@GetMapping("/preQuestion")
	public R<String> preQuestion(Long questionId) {
		return R.ok(questionService.preQuestion(questionId));
	}

	@GetMapping("/nextQuestion")
	public R<String> nextQuestion(Long questionId) {
		return R.ok(questionService.nextQuestion(questionId));
	}
}
